<template>
  <div class="notice" :style="{minHeight:$store.state.minHeight+'rem'}">
    <myHead title="公告" background-color="linear-gradient(170deg,rgba(251,68,72,1) 0%,rgba(254,111,77,1) 100%)"></myHead>
    <div class="noticeList">
      <div class="list" v-if="list" v-for="(item) in list">
        <div class="time">{{item.updatetime | formatDate}}</div>
        <div class="content">
          <div class="name">{{item.title}}</div>
          <div class="desc">{{item.content}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import myHead from "../../components/BusinessComponents/lib/myHead";
  import {formatDate} from '../../methods/time'
  export default {
      name: "notice",
      filters: {
          formatDate(time) {
            time = time * 1000;
            let date = new Date(time);
            return formatDate(date, 'yyyy年MM月dd日 hh:mm')
          }
      },
      components: {
        myHead
      },
      data() {
        return {
          list:[]
        };
      },
      methods: {

      },
    mounted() {
      this.store_info = JSON.parse(localStorage.getItem("storeInfo"));
      //商品分类列表
      this.$myAxios('/store/index/notice_list', 'get', {
        store_id:this.store_info.id,
      }).then(res => {
        if(res.data.code == 1){
          this.list = res.data.data;
        }else{
          this.$myNotice(res.data.msg,2000)
        }
      });
    }
  }
</script>

<style scoped>
  .notice{
    background: #F5F5F5;
  }
  .noticeList{
    padding: .6rem .16rem 0;
  }
  .noticeList .list{
    margin: 0 0 .2rem;
  }
  .noticeList .list .time{
    width: 1.5rem;
    margin: 0 auto .2rem;
    height: .2rem;
    line-height: .2rem;
    background: #CCCCCC;
    text-align: center;
    color: #ffffff;
    font-size: .12rem;
    border-radius: .04rem;
  }
  .noticeList .list .content{
    background: #ffffff;
    padding: .15rem .2rem;
    border-radius: .04rem;
  }
  .noticeList .list .content .name{
    color: #333333;
    font-size: .16rem;
  }
  .noticeList .list .content .desc{
    color: #999999;
    font-size: .12rem;
    margin-top: .06rem;
  }
</style>
